// API响应类型定义

// 基础API响应类型
export interface ApiResponse<T = unknown> {
  success: boolean;
  data?: T;
  message?: string;
  code?: number;
}

// 分页响应类型
export interface PaginatedResponse<T> {
  success: boolean;
  data: T[];
  pagination: {
    current: number;
    pageSize: number;
    total: number;
    totalPages: number;
  };
  message?: string;
}

// 错误响应类型
export interface ErrorResponse {
  success: false;
  message: string;
  code?: number;
  details?: string | object;
}

// 文件上传响应类型
export interface UploadResponse {
  success: boolean;
  data: {
    id: string;
    filename: string;
    originalName: string;
    url: string;
    size: number;
    mimeType: string;
  };
  message?: string;
}

// 统计数据响应类型
export interface StatsResponse {
  success: boolean;
  data: {
    totalProducts: number;
    totalCases: number;
    totalUsers: number;
    totalVisits: number;
  };
}

// 认证相关响应类型已移至 types/index.ts

// 请求参数类型
export interface PaginationParams {
  page?: number;
  pageSize?: number;
  search?: string;
  sortBy?: string;
  sortOrder?: 'asc' | 'desc';
}

// 产品查询参数
export interface ProductQueryParams extends PaginationParams {
  type?: string;
  status?: string;
  featured?: boolean;
  priceMin?: number;
  priceMax?: number;
  materials?: string[];
  processes?: string[];
}

// 案例查询参数
export interface CaseQueryParams extends PaginationParams {
  industry?: string;
  status?: string;
  featured?: boolean;
  tags?: string[];
  year?: string;
  location?: string;
}

// 标签查询参数
export interface TagQueryParams extends PaginationParams {
  type?: 'case' | 'product';
  status?: 'active' | 'inactive';
}

// 轮播图查询参数
export interface BannerQueryParams extends PaginationParams {
  status?: 'active' | 'inactive';
}

// 创建/更新请求类型
export interface CreateProductRequest {
  name: string;
  type: string;
  description?: string;
  price?: string;
  priceMin?: number;
  priceMax?: number;
  unit?: string;
  images: string[];
  features?: string[];
  tags?: string[];
  craftTypes?: string[];
  specifications?: Record<string, unknown>;
  featured?: boolean;
  status: 'active' | 'inactive' | 'draft';
  sort?: number;
}

export interface UpdateProductRequest extends Partial<CreateProductRequest> {
  id: string;
}

export interface CreateCaseRequest {
  title: string;
  industry: string;
  description?: string;
  content?: string;
  images: string[];
  services?: string[];
  highlights?: string[];
  challenges?: string;
  solutions?: string;
  results?: string;
  tags?: string[];
  clientName?: string;
  duration?: string;
  projectDate?: string;
  completedAt?: string;
  location?: string;
  projectValue?: string;
  background?: string;
  requirements?: string;
  featured?: boolean;
  status: 'active' | 'inactive' | 'draft';
  sort?: number;
}

export interface UpdateCaseRequest extends Partial<CreateCaseRequest> {
  id: string;
}

export interface CreateTagRequest {
  name: string;
  type?: 'case' | 'product';
  color?: string;
  status: 'active' | 'inactive';
}

export interface UpdateTagRequest extends Partial<CreateTagRequest> {
  id: string;
}

export interface CreateBannerRequest {
  title: string;
  subtitle?: string;
  image: string;
  sort?: number;
  status: 'active' | 'inactive';
}

export interface UpdateBannerRequest extends Partial<CreateBannerRequest> {
  id: string;
}